//获取应用实例
const app = getApp()
const innerAudioContext = wx.createInnerAudioContext()
Page({
    data: {
      report:{},
      reportId:"",
      image_file_urls:[],
      playAudioShow:false,
      audio_url:""
    },
    onLoad: function(options) {
      if (options != null){
        const reportId= options.reportId;
        this.setData({reportId})
        wx.request({
          url: app.globalData.url+'/wechat/report?reportId='+reportId,
          method: 'get',
          success: res2 => {
            this.setData({
              report:res2.data||{},
              image_file_urls:res2.data&&res2.data.image_file_urls||[],
              audio_url:res2.data&&res2.data.audio_url
            });
            wx.setNavigationBarTitle({
              title: res2.data&&res2.data.score_item||"实验"
          })
          }
        })
        
      }
    },
    playRecordAudio() {
      //在ios下静音时播放没有声音，默认为true，改为false就好了。
      innerAudioContext.obeyMuteSwitch = false
        this.setData({
          playAudioShow: true,
        })
        innerAudioContext.src = this.data.audio_url
        innerAudioContext.play()
        innerAudioContext.onEnded(() => {
          this.setData({
            playAudioShow: false,
          })
        })
    },
  })
